/**
 * Copyright (c) 2014-2018, huli.com
 * All rights reserved.
 */
package com.xiaohujr.xuexue.refactor;

import java.io.*;
import java.util.ArrayList;

/**
 * @author Xue Xue (xuexue1@huli.com)
 * @version $Id$
 * @since 2019/11/5
 */
public class Test {
    public static void main(String[] args) throws IOException {
        ArrayList<String> arrayList = new ArrayList<>();
        try {

            File file = new File("/Users/xuexue/Downloads/xyd.txt");
            FileReader fr = new FileReader(file);
            BufferedReader bf = new BufferedReader(fr);
            String str;
            // 按行读取字符串
            while ((str = bf.readLine()) != null) {
                arrayList.add(str);
            }
            bf.close();
            fr.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        // write string to file

        FileWriter writer = new FileWriter("/Users/xuexue/Downloads/xyd_upd.txt");

        BufferedWriter bw = new BufferedWriter(writer);

        System.out.println(arrayList.size());
        for (String str : arrayList) {
            String[] arr2 = str.split(",");
            bw.write("UPDATE `soeasy_risk_rule`.`loan` SET `grant_amount` = " + arr2[1] +
                    " WHERE `bidId` = '" + arr2[0] + "' AND `biz_code` IN ('80001002','80000001');\n");

        }

        bw.close();

        writer.close();
    }
}
